package com.xiaofan.controller;

import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttribute;

import javax.servlet.http.HttpSession;

/**
 * @author 晓帆
 * @version 1.0
 **/
@RestController
@RequestMapping("restful")
public class RestfulControllerDemo {
    @RequestMapping("cookie")
    public void getCookieValue(@CookieValue("songge")String songge, @CookieValue("shitou") String shitou, HttpSession session){
        session.setAttribute("songge",songge);
        session.setAttribute("shitou",shitou);
        System.out.println(shitou);
        System.out.println(songge);
    }
    @RequestMapping("session")
    public void getSessionValue(@SessionAttribute("shitou") String shitou,@SessionAttribute("songge") String songge){
        System.out.println(shitou);
        System.out.println(songge);
    }
}
